# Copyright (c) 2023 HiSilicon (Shanghai) Technologies CO., LIMITED.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

CUR_MK_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CUR_MK_DIR := $(dir $(CUR_MK_PATH))
CUR_MK_DIR := $(realpath $(CUR_MK_DIR))

# 计算第一个参数相对于第二个参数的相对路径
define calc_relpath
$(shell python3 -c "import os.path; print(os.path.relpath('$(1)','$(2)'))")
endef

# 项目顶层目录（不要其他Makefile中使用）
_TOP_DIR := $(realpath $(CUR_MK_DIR))
_PLATFORM_DIR := $(realpath $(CUR_MK_DIR)/../../platform)

# 平台目录
PLATFORM_INC_DIR := $(_PLATFORM_DIR)/inc
PLATFORM_CFG_DIR := $(_PLATFORM_DIR)/cfg
PLATFORM_DRV_DIR := $(_PLATFORM_DIR)/drv
PLATFORM_DEVICE_DIR := $(_PLATFORM_DIR)/drv/device
PLATFORM_HCC_DIR := $(_PLATFORM_DIR)/hcc
PLATFORM_OSAL_DIR := $(_PLATFORM_DIR)/osal
PLATFORM_LIBC_SEC_DIR := $(_PLATFORM_DIR)/libc_sec
